<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/template/main_template.xhtml" 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:sec="http://www.springframework.org/security/tags">
	
<ui:define name="title">
Project Setup
</ui:define>

<ui:define name="content">	

<p:panel id="panel" header="Project Setup - Summary Project List" style="width:95%">  
    
<p:focus context="panel"/> 
      
	<h:form>  
    <p:dataTable var="c" value="#{projectSetup.projects}" paginator="true" rows="10"  paginatorPosition="bottom"
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15" >   
        <p:column headerText="Project Code" sortBy="#{c.projectCode}">  
            <h:outputText value="#{c.projectCode}">
            	
            </h:outputText>
        </p:column>  
  
        <p:column headerText="Project Name" sortBy="#{c.projectName}">  
           <h:outputText value="#{c.projectName}"/>
        </p:column>  
  
        <p:column headerText="Date Launched" sortBy="#{c.launchDate}">  
            <h:outputText value="#{c.launchDate}">
            <f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT+8"/>  
            </h:outputText>
        </p:column>  
  
        <p:column headerText="Property Type" sortBy="#{projectSetup.getCodeDesc('PT', c.propertyType)}">  
           <h:outputText value="#{projectSetup.getCodeDesc('PT', c.propertyType)}"/>
        </p:column>  
        
        <p:column headerText="Status" sortBy="#{projectSetup.getCodeDesc('SS', c.status)}">  
           <h:outputText value="#{projectSetup.getCodeDesc('SS', c.status)}"/>
        </p:column>
        
        <p:column headerText="Action">  
           <p:commandButton action="#{projectSetup.editProject}" ajax="false" icon="ui-icon-pencil" title="Edit Project">
           		 <f:setPropertyActionListener value="#{c}" target="#{projectSetup.project}" />  
           </p:commandButton>
           &nbsp;
           <p:commandButton action="#{projectSetup.toInventoryList}" ajax="false" icon="ui-icon-folder-open" title="Inventory List">
           		 <f:setPropertyActionListener value="#{c}" target="#{projectSetup.project}" />  
           </p:commandButton>
        </p:column>

  
    </p:dataTable>  
    
    <br/>
    
    <p:commandButton action="#{projectSetup.addNewProject}" value="Add Project" ajax="false"/>
</h:form> 

</p:panel>

</ui:define>

</ui:composition>